#ifndef LOG_H
#define LOG_H

#include <iostream>
#include <stdio.h>
#include <time.h>

class Log
{
public:
	static void Write(std::string msg)
	{
		time_t rawtime;
  		struct tm * timeinfo;
		char linea[80];
		std::string titulo("TIME: ");
		std::string toWrite("");

		memset(linea, '-', 79);
		linea[79]='\n';

		FILE * fd = fopen("Log.txt", "a");
		
		if(fd != NULL)
		{
			time ( &rawtime );
			timeinfo = localtime ( &rawtime );
			titulo += asctime (timeinfo);
			toWrite += msg;
			toWrite += "\n";
			
			fputs(linea, fd);
			fputs(titulo.c_str(), fd);
			fputs(toWrite.c_str(), fd);
			fclose(fd);
		}
	}
	
};

#endif
